module.exports = app => {
    const { STRING, INTEGER, DATE, ENUM, TEXT } = app.Sequelize;
  
    const Slide = app.model.define('slide', {
      id: {
        type: INTEGER(20),
        primaryKey: true,
        autoIncrement: true,
      },
      title: {
        type: STRING(30),
        allowNull: false,
        defaultValue: '',
        comment: "标题",
      },
      images: {
        type: STRING(90),
        allowNull: false,
        defaultValue: '',
        comment: "图片",
      },
      link: {
        type: STRING(30),
        allowNull: true,
        defaultValue: "",
        comment: "链接",
      },
      order: {
        type: INTEGER(60),
        allowNull: true,
        defaultValue: 0,
        comment: "排序",
      },
      status: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 1,
        comment: "状态 0禁用 1启用",
      }, 
        created_time: {
          type:DATE,
          get(){
             return app.formatTime(this.getDataValue('created_time'))
          }
        },
        updated_time: DATE,
      });
  
    return Slide;
  };